	
	//라운드목록
	function clsClubRoundList_List(){
		this._HTMLDom = null;
		this.listData = null;
		this.page = null;
		this._init();
	}
	
	clsClubRoundList_List.prototype = {
		_init: function(){
			var $layer = $("section#club_round_list>section ul.club_round_list");
			this._HTMLDom = {
				"$layer": $layer
				, "$element": $layer.find(">li:eq(1)")
				, "$empty": $layer.find(">li:eq(0)")
			}			
			$layer.empty();
		}
		, setList: function(thisData){
			if(!this.listData) this.listData = [];	
			this.push(thisData);
		}	
		, push: function(thisData){
			var thisClass = this;
			var $element = this._HTMLDom["$element"];
			var $tmp = [];
		
			for(var i=0;i<thisData.length;++i){
				$tmp.push($element.clone(true));				
				$tmp[i].find("li.nickname").html(thisData[i]["닉네임"]);
				if(thisData[i]["라운딩진행상태"]=="P"){
					$tmp[i].find("li.state span").attr("class", "state_ing").html("진행");
				}else if(thisData[i]["라운딩진행상태"]=="C"){
					$tmp[i].find("li.state span").attr("class", "state_ok").html("확정");
				}else if(thisData[i]["라운딩진행상태"]=="D"){
					$tmp[i].find("li.state span").attr("class", "state_finish").html("마감");
				}				
				$tmp[i].find("li.sub").html(thisData[i]["라운드명"]);
				$tmp[i].find("li.golf_c").html(thisData[i]["코스명"] +"<em>"+ thisData[i]["홀수"] +"H</em>");
				$tmp[i].find("li.team").html("<mark>"+ thisData[i]["모집팀수"] +"팀</mark>(" + thisData[i]["모집인원수"] +"명)");
				$tmp[i].find("li.offer mark").html(thisData[i]["신청인원수"]);
				$tmp[i].find("li.assign mark").html(thisData[i]["배정완료수"]);
				thisClass.listData.push(thisData[i]);
			}
			
			this.display($tmp);
		}
		, display: function(thisData){
			var $layer = this._HTMLDom["$layer"];
					
			for(var i=0;i<thisData.length;++i){
				$layer.append(thisData[i]);	
			}
			
			if(!this.listData.length) {				
				$layer.append(this._HTMLDom["$empty"]);
			}
		}
		, reset: function(){
			this.listData = [];			
			this._HTMLDom["$layer"].empty();
		}
		, $getBtnMore: function(){		
			return this._HTMLDom["$layer"].parent().parent().find("div.btn_more");
		}
		, $getBtnWrite: function(){
			return $("section#club_round_list>section div.club_btn a");
		}
		, $getLayer: function(){			
			return this._HTMLDom["$layer"];
		}
		, getListCount: function(){
			if(!this.listData) return 0;
			return this.listData.length;
		}
	}
	
	//데이터연동		
	function clsComm_ClubRoundList(){		
		this.clubRoundList = null;
		this.clubRoundListPageData = null;
		this.clubRoundListRequest = null;
		
		this._init();
	}	
	clsComm_ClubRoundList.prototype = {
		_init: function(){
			this.clubRoundListRequest = {
				 "동호회키":null
				, "라운드키": null
				, "페이지": null				
			}
			
			this.clubRoundListPageData = {
				"전체수": null	
			}
		}
//------------------------ 라운드목록------------------------//		
		, getClubRoundList: function(){
			var thisClass = this;
			
			var szClubSeq = this.clubRoundListRequest["동호회키"];
			var szPage = this.clubRoundListRequest["페이지"];
			
			var objJson = new MJson();
        	var cm = new ConnectionManager();
			
			objJson.putClient("userid", _util.getLogin("아이디"));
        	objJson.putPub("sid", "CL001");
        	objJson.putPub("servicename","getClubRoundList");   
        	objJson.putPub("listcount", 10);   
        	objJson.putPub("currpageno", szPage);
        					
        	objJson.putParameter("club_seq", szClubSeq);
			
			cm.requestGet(objJson.getJsonString(), function(ret){
				thisClass.clubRoundList = [];
				thisClass.clubRoundListPageData["전체수"] = ret["msp"]["contents"]["@totalcount"];
				
				var items = ret["msp"]["contents"]["items"]
			
				if(items){					
					thisClass.clubRoundListPageData = {
						"전체수": ret["msp"]["contents"]["@totalcount"]
					}					
					
					if(!items.length){
						items = new Array(items);
					}
					
					for(var i=0;i<items.length;i++){
						var obj = items[i];
						
						//동호회목록
						thisClass.clubRoundList.push({
							"동호회키": _util.nvl(obj["roundInfo"]["clubSeq"])
							, "아이디": _util.nvl(obj["userMaster"]["userId"])
							, "닉네임": _util.nvl(obj["userMaster"]["nickname"])
							, "라운드키": _util.nvl(obj["roundInfo"]["roundSeq"])
							, "라운드일자": _util.nvl(obj["roundInfo"]["reservDate"])
							, "라운드요일": _util.nvl(obj["roundInfo"]["reservDay"])
							, "라운드시간": _util.nvl(obj["roundInfo"]["firstTime"])
							, "코스명": _util.nvl(obj["roundInfo"]["golfclubCourseInfo"])
							, "홀수": _util.nvl(obj["roundInfo"]["holeInfo"])
							, "라운드명": _util.nvl(obj["roundInfo"]["title"])
							, "모집팀수": _util.nvl(obj["roundInfo"]["totalTeamCnt"])
							, "모집인원수": _util.nvl(obj["roundInfo"]["totalMember"])
							, "신청인원수": _util.nvl(obj["roundInfo"]["requestedMemberCnt"])
							, "배정완료수": _util.nvl(obj["roundInfo"]["assignedMemberCnt"])
							, "라운딩진행상태": _util.nvl(obj["roundInfo"]["procStatus"]) //진행중(0),확정(1),마감(2)					
							, "프로필": []								
						});
					}         
				}
				
				$(thisClass).trigger("evtFinishClubRoundList");
			}, function($err) {
				alert($err);
			});	
		}
		, getClubRoundListData: function(){
			return this.clubRoundList;
		}
		, getClubRoundListPageData: function(){
			return this.clubRoundListPageData;
		}
		, setClubRoundListRequest: function(key, val){
			this.clubRoundListRequest[key] = val;
		}
		, getClubRoundListRequest: function(key){
			return this.clubRoundListRequest[key];
		}	
//------------------------ 라운드목록------------------------//			
	}
	
	//컨트롤파일
	function ClubRoundList(){				
		this.objComm = null;
		this.club_seq = null;	
		this.club_info = null;		
		
		this.objClubRoundList_List = null;
	};
	
	ClubRoundList.prototype = {
	    onPageShow : function() {	    
	    	$("a").attr("href", "").attr("data-rel", "");      
	    	this._init();	    		    	
	    }
	    , _beforeStart: function(){
	    	var 	thisClass = this;
	    	
	    	this._permitStart = {
				"동호회정보": false	
			}
			
	  		// 서버 메시지맵
			$.ajax({
				url: "../js/src/club/club_inc.js"
				, type: "get"
				, dataType: "script"
				, async: false
				, success: function(ret, sta){
					//alert("success!!");					
				}
				, error:function(e){
					alert("error=" + e);
				}	
			});
			
			_cb.getClubInfoData({
				"콜백": function(ret, l){
					thisClass._permitStart["동호회정보"] = true;	
				}
			});
			
			_util.executeThread(function(){
				for(key in thisClass._permitStart){		
					if(!thisClass._permitStart[key]) return false;
				}
				return (true);
			}, function(){			
				thisClass._start();
			});
	    }
	    , _init: function(){	    	    	
	    		    	
	    	this.objComm = new clsComm_ClubRoundList();
			this.objClubRoundList_List = new clsClubRoundList_List();
			
	      this.getParam();
	      
	      this._beforeStart();
	    	
	    	this._role();
	       
	      	this._bind();	 
	      	this._eventFinish();     	
	    }
	    , _start: function(){	    	
	    	//동호회기본정보
	    	this.club_info = _cb.getClubInfo();
	    	
	    	//라운드목록조회
			this.spinStart();
			this.objComm.setClubRoundListRequest("동호회키",this.club_seq);
			this.objComm.setClubRoundListRequest("페이지",1);
			this.objComm.getClubRoundList();			
	    }
	    , _eventFinish: function(){
	    	var thisClass = this;
	    	
	    	//동호회 글목록조회  완료 이벤트 
			$(this.objComm).bind("evtFinishClubRoundList", function(){
				var thisData = thisClass.objComm.getClubRoundListData();
				var totalCnt = thisClass.objComm.getClubRoundListPageData();				
				thisClass.objClubRoundList_List.setList(thisData);
				thisClass.spinEnd();
				
				//더보기 버튼 
		 		if(thisClass.objClubRoundList_List.getListCount() >= totalCnt["전체수"]) {
		 			thisClass.objClubRoundList_List.$getBtnMore().hide();
		 		}else {
		 			thisClass.objClubRoundList_List.$getBtnMore().show();
		 		}
			});
	    }
		 , _bind: function(){
		 	var thisClass = this;
		 	
		 	//더보기
		 	this.objClubRoundList_List.$getBtnMore().click(function(event){
		 		event.preventDefault();
		 		var page = thisClass.objComm.getClubRoundListRequest("페이지");
		 		thisClass.objComm.setClubRoundListRequest("페이지",(page+1));
		 		thisClass.objComm.getClubRoundList();
		 		thisClass.spinStart();
		 	});
		 	
		 	//상세보기
		 	this.objClubRoundList_List.$getLayer().on("click", "a", function(event){
		 		event.preventDefault();
		 		var n = thisClass.objClubRoundList_List.$getLayer().find("a").index($(this));
		 		
		 		if(!_util.getLogin("아이디")){
		 			thisClass.goLogin();
		 			return;
		 		}else if(!thisClass.club_info.isMember()){
		 			alert(thisClass.club_info.getError());
		 			return;
		 		}
		 		
		 		_gf.CLUB_DATA = {
		 			"동호회키": thisClass.club_seq
		 			, "라운드키": thisClass.objClubRoundList_List.listData[n]["라운드키"]
		 		}
		 		$.mobile.changePage("club_round_view.html","slide",true);
		 	});
		 	
		 	//글쓰기
		 	this.objClubRoundList_List.$getBtnWrite().click(function(event){
		 		event.preventDefault();		 				 		
		 		
		 		if(!_util.getLogin("아이디")){
		 			thisClass.goLogin();
		 			return;
		 		}else if(!thisClass.club_info.isAdmin()){
		 			alert(thisClass.club_info.getError());
		 			return;
		 		}
		 		
		 		if(!_util.getLogin("아이디")){		   			
		 			thisClass.goLogin();
		 			return;
		 		}
		 				 		
		 		_gf.CLUB_DATA = {
		 			"동호회키": thisClass.club_seq
		 		}
		 		$.mobile.changePage("club_round_record.html","slide",true);
		 	});
		 			 	
		 	//메뉴
		 	$("section#club_round_list nav ul li a:eq(0)").click(function(event){
		 		event.preventDefault();
		 		thisClass.goNavi();
		 	});
		 	
		 	//알림
		 	$("section#club_round_list nav ul li:eq(1)").click(function(event){
		 		event.preventDefault();
		 		$.mobile.changePage("../inc/info_booking.html","slide",true);	
		 	});
		 	
		 	//이전
		 	$("section#club_round_list header div.top_title_B div.top_left a.btn10").click(function(event){
		 		event.preventDefault();
		 		_gf.CLUB_DATA = {
					"동호회키": thisClass.club_seq	
				}
		 		$.mobile.changePage("self_club.html","slide",true);	
		 	});
		 }
		 , getParam: function(){
	    	this.club_seq = _gf.CLUB_DATA["동호회키"];	    	    	
	    }
	    , _role: function(){
	    		
	   }
		, goNavi: function(){			
			$.mobile.changePage("../inc/navi.html","slide",true);
		}
		, goLogin: function(){
			_gf.LOGIN_DATA.loginAfterUrl = "../club/club_round.html";
			$.mobile.changePage("../member/login.html","slide",true); 
		}
	    , spinStart: function(){		
			$.mobile.showPageLoadingMsg();			
		}
		, spinEnd: function(){			
	 		$.mobile.hidePageLoadingMsg();				
		}
	}